Skip to content

Conversation

jaejeong1
Copy link
Contributor

@jaejeong1 jaejeong1 commented Aug 18, 2024

#253과 #268 문제는 바로 풀리지가 않아, 유사한 유형의 Easy 문제를 더 풀어본 후 추후 도전해보려합니다.

이번 PR은 #218 #233 #238 로 리뷰 후 승인해주시면 감사하겠습니다.

@dev-jonghoonpark
Copy link
Contributor

3 문제 코드 잘보았습니다. : )
남은 2문제도 파이팅!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

홀, 짝으로 수를 나누어 차례대로 올라갈수록 1이 올라가는 방식이군요!
n & 1 또는 Integer.bitCount(n) 과 같은 bit 연산자를 사용하여 풀어보시는 것도 추천드려요!
아마 TC, SC는 동일하게 나올거에요.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TonyKim9401 좋은 피드백 감사합니다! 비트 연산자 사용하는 게 더 간단한 코드로 풀이할 수 있겠네요 :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

map을 사용하지 않고 주어진 s, t를 Charactor Array로 변환 후 정렬해서 각 인덱스를 비교하는 방법도 추천 드립니다!
대신 정렬을 사용하면 O(n log n)이 되어서, TC적인 면에서는 Map 사용이 더 효율적인것 같아요 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TonyKim9401 sorting 을 사용하지 않고자 map을 사용했는데, 좋은 대안 제시해주셔서 감사합니다! 다른 문제 풀이 시 참고하겠습니다 :)

// 풀이: 해시맵을 사용해 s와 t의 문자 별 빈도수를 저장한다
// 두 빈도수의 모든 키와 값이 같고, 크기가 같은지 비교한다.
// 다르다면 false를 반환, 모두 같다면 true를 반환한다.
// 시간복잡도: O(N), 공간복잡도: O(N)
Copy link
Contributor

@taekwon-dev taekwon-dev Aug 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s and t consist of lowercase English letters.

^ 단서에 의해서 - 입력 값이 영어 소문자로만 구성된 케이스만 고려하면 되므로, Map의 최대 사이즈가 입력 값에 영향을 받지 않는다는 점을 고려해서 공간 복잡도를 다시 한 번 생각해보면 좋을 것 같습니다! 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@taekwon-dev
공간복잡도 계산 시 입력이 어떤 값이 들어오는지 고려해줘야겠었군요!!
좋은 피드백 감사합니다 :) 피드백 반영해 공간복잡도 1 로 수정했습니다 :)

@jaejeong1 jaejeong1 marked this pull request as ready for review August 22, 2024 14:00
Copy link
Member

@DaleSeo DaleSeo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이번 PR은 #218 #233 #238 로 리뷰 후 승인해주시면 감사하겠습니다.

이렇게 명확히 승인 기준을 제시해주시니 좋네요! 👍 수고하셨습니다.

@jaejeong1 jaejeong1 merged commit c9df583 into DaleStudy:main Aug 24, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Status: Completed
Development

Successfully merging this pull request may close these issues.

6 participants